﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dragon.Prototype1.Infrastructure.Controls
{
    public class Literal : WebControl
    {
        public Literal()
        {
            NeedEncoding = false;
        }

        public Literal(string text)
        {
            this.Text=text;
        }

        public bool NeedEncoding
        {
            get;
            set;
        }

        public string Text
        {
            get;
            set;
        }

        public override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            string text = this.Text;
            if (string.IsNullOrEmpty(text))
                return;

            if (this.NeedEncoding)
            {
                writer.Write(Microsoft.Security.Application.AntiXss.HtmlEncode(text));
            }
            else
            {
                writer.Write(text);
            }

        }
    }
}
